﻿//----------------------------------------------------------------
// Desc: 注册表USR键访问
// Edit: ShowLong, http://blog.csdn.net/showlong
//
// Date Created: 2011-04-18
//
// Update Date : 
//
// Copyright (c) Fuel4D (http://www.fuel4d.com), All rights reserved.
//
//----------------------------------------------------------------
#pragma once

FINLINE bool IFRegedit::WriteString (const NCHAR* keyname, const NCHAR* strValue)
{
#ifdef UNICODE
    return WriteStringW(keyname, strValue);
#else
    return WriteStringA(keyname, strValue);
#endif
}

FINLINE bool IFRegedit::WriteStringA(const ACHAR* keyname, const ACHAR* strValue)
{
    return WriteStringW(FStringW(keyname), FStringW(strValue));
}

FINLINE bool IFRegedit::WriteInt (const NCHAR* keyname, int dwValue)
{
#ifdef UNICODE
    return WriteIntW(keyname, dwValue);
#else
    return WriteIntA(keyname, dwValue);
#endif
}

FINLINE bool IFRegedit::WriteIntA(const ACHAR* keyname, int dwValue)
{
    return WriteIntW(FStringW(keyname), dwValue);
}

FINLINE bool IFRegedit::WriteGUID (const NCHAR* keyname, FGUID guidValue)
{
#ifdef UNICODE
    return WriteGUIDW(keyname, guidValue);
#else
    return WriteGUIDA(keyname, guidValue);
#endif
}

FINLINE bool IFRegedit::WriteGUIDA(const ACHAR* keyname, FGUID guidValue)
{
    return WriteGUIDW(FStringW(keyname), guidValue);
}

FINLINE bool IFRegedit::WriteBool (const NCHAR* keyname, bool bValue)
{
#ifdef UNICODE
    return WriteBoolW(keyname, bValue);
#else
    return WriteBoolA(keyname, bValue);
#endif
}

FINLINE bool IFRegedit::WriteBoolA(const ACHAR* keyname, bool bValue)
{
    return WriteBoolW(FStringW(keyname), bValue);
}

FINLINE bool IFRegedit::ReadString (const NCHAR* keyname, NCHAR* strValue, DWORD& dwLength, const NCHAR* strDefault)
{
#ifdef UNICODE
    return ReadStringW(keyname, strValue, dwLength, strDefault);
#else
    return ReadStringA(keyname, strValue, dwLength, strDefault);
#endif
}

FINLINE bool IFRegedit::ReadInt (const NCHAR* keyname, int* pdwValue, int dwDefault)
{
#ifdef UNICODE
    return ReadIntW(keyname, pdwValue, dwDefault);
#else
    return ReadIntA(keyname, pdwValue, dwDefault);
#endif
}

FINLINE bool IFRegedit::ReadIntA(const ACHAR* keyname, int* pdwValue, int dwDefault)
{
    return ReadIntW(FStringW(keyname), pdwValue, dwDefault);
}

FINLINE bool IFRegedit::ReadGUID (const NCHAR* keyname, FGUID* pGuidValue, FGUID& guidDefault)
{
#ifdef UNICODE
    return ReadGUIDW(keyname, pGuidValue, guidDefault);
#else
    return ReadGUIDA(keyname, pGuidValue, guidDefault);
#endif
}

FINLINE bool IFRegedit::ReadGUIDA(const ACHAR* keyname, FGUID* pGuidValue, FGUID& guidDefault)
{
    return ReadGUIDW(FStringW(keyname), pGuidValue, guidDefault);
}

FINLINE bool IFRegedit::ReadBool (const NCHAR* keyname, bool* pbValue, bool bDefault)
{
#ifdef UNICODE
    return ReadBoolW(keyname, strValue, bDefault);
#else
    return ReadBoolA(keyname, strValue, bDefault);
#endif
}

FINLINE bool IFRegedit::ReadBoolA(const ACHAR* keyname, bool* pbValue, bool bDefault)
{
    return ReadBoolw(FStringW(keyname), pbValue, bDefault);
}
